package com.shinewind.gateway.result;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.http.HttpStatus;

import java.io.Serializable;

@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class Result implements Serializable {
    private Integer status;
    private boolean flag;
    private String message;

    public static Result error(Integer status,boolean flag){
        Result result = Result.builder()
                .status(status)
                .flag(flag)
                .build();
        return result;
    }

    public static Result error(Integer status,boolean flag,String message){
        Result result = Result.builder()
                .status(status)
                .flag(flag)
                .message(message)
                .build();
        return result;
    }

    public static Result error(boolean flag,String message){
        Result result = Result.builder()
                .flag(flag)
                .message(message)
                .build();
        return result;
    }

    public static Result fail(boolean flag,String message){
        Result result = Result.builder()
                .flag(flag)
                .message(message)
                .build();
        return result;
    }

    public static Result fail(String message){
        Result result = Result.builder()
                .message(message)
                .build();
        return result;
    }
}
